package study01;

/**
* @author GZQ
* @Date 2023/11/5
 */

//不同数据类型之间的转换
public class DataTypeTrans {
    public static void main(String[] args) {
        byte b = 100; //1个字节
        short s = b; //2个字节
        int i = s; //4个字节
        long l = i; //8个字节
        System.out.println(l);
        l = 99; //8个字节
        i = (int)l; //4个字节
        s = (short)i;//2个字节
        b = (byte)s; //1个字节
        System.out.println(b);
        float f = 3.1552f;
        double d = f;
        System.out.println(d);
        d = 3.1999527699;
        f = (float)d;
        System.out.println(f);
        i= 10000;
        f = i;
        System.out.println(f);
        d = 10000.5555555555;
        i = (int)d;
        System.out.println(i);
    }
}

